sql fixes quotes and error messages