fix the broken code because of previous refactoring