fix error in sql statement