fix crash bug from previous commit