Fixed unneeded quotes in sql queries

Fixed unneeded quotes in sql queries and encoding problem in IE