#14 Fixed problems introduced during refactoring