syntax and prevent error when query is undefined