Fixed some crashing issues.