Fix some bugs.

Sorry, I was drunk.