fixed all the bugs