Fixed simulator crash on error.