corrected some of the bugs