Fixed potential crash in certain doomsday scenarios.