backport of NPE fix to release branch
Merge remote-tracking branch 'origin/release'