Avoided a few possible crashes