Add/fix some trivial null checks