Fixed some big bugs