Added more crash prevention