modify bug and remove useless code