Fixed crash in simulator