Fixed possible NPE.