fixed error caused by new line characters in query