Potentially fixed some nasty crashes