changed query build