fixed bug that occurred while refactoring