fixed the bug which occured after refactoring