fixed error in sql