fixed the bugs