improved crash handling