Fixed string escaping issues where a ' would cause the SQL to break.