Fixing bugs after refactoring.