Tried to prevent some crashes.