Refactoring for fix bugs.