preventing ugly crashes