Fixed bugs in refactoring commit.