fixed issues with refactoring