fixes unexpected result when the query contains blanks (space characters)