Fixed a ton of bugs.