Fix missing parenthesis in query