Fixed a few very strange bugs