Fix a few bugs related to latest refactoring

What a commit message...