PLA-460 fixing query building