Fixed some of the bugs.