Fixed a possible NPE.