Fix some crashes.