fixed invalid queries