fixed a bug due to a refactoring