Fixed some bugs.

Yay bug smashing