fixing up the bugs