fixed bug when refactoring