Fix to NPE that can sometimes occur but is not serious.