Fixed some of the problems found