minor bug fix relating to sql single quote problems.