NPE fix from master