fix crash due to code refactor