Fixed some crashes.