Fix 2 common crashes