Fixes for issues introduced in the previous refactoring.