minor bug fix after refactoring.