fix to syntax error in query