fix some crashes.