fix bugs and del unnecassery