fixing query nonsense