fix bug caused by partial refactoring