Fixed a NPE that was previously avoided