fix critical bug after refactor