fixing all the bugs