bug fix while refactoring