Fixed some bugs introduced on the last commit.