Fixed a few random bugs.