Bug fixes related to refactoring.