Fixed a bunch of problems