fix syntax in query