Fixing query conditions.