Deleted useless code and fixed error