Remove 'Illegal character in query' error