Tiny fix for malformed queries