fixing query