A few defensive checks against possible NPEs