Fix problem with spaces in query