Fix activity recreation and other activity lifecycle glitches.