Fixed more bugs

Ooops, this time I actually fixed the bugs.