Fixed a bunch of error logging, cleaned up some mixed tabs/spaces