Put query_factory at the end in case someone somewhere is passing parameters by position. Also fix bug in query_factory assignment.
Put query_factory at the end in case someone somewhere is passing parameters by
position. Also fix bug in query_factory assignment.

mithrandi/txaws,mithrandi/txaws,twisted/txaws,twisted/txaws,oubiwann/txaws,oubiwann/txaws