Fix query syntax and move precondition exec

precondition exec is now executed within its own transaction