Fixed a bug in refactoring.