fixed errors after refactoring