bugfixing after refactoring