Some more fixes after refactoring