Fixed a few bugs in the last commit.