fix error in sql