Fixed a bunch of super embarrassing bugs.