implemented improved crash logic with appropriate test