fixed minor bug after refactoring