fix error and delete some useless code