fix problem with single quotes on query

queries fail when there is a single quote in one of the parameters. This is a fix. This does not fix the issue in srem.