incorrectly positioned query build