Fixed a few bugs with the last commit.