fix SQL statement