Prevent some crashes