Fixed some bugs that I left in my last commit.