fix crash in simulator