Fixed bug due to refactoring