update the bugs and remove unused to codes