fixed errors after refactoring ))