Add check to avoid NPE.