Various bugfixes regarding to latest refactoring.