fixed validation bug in queryHandler