Fix some creepy crashes.