NPE fix

(cherry picked from commit 5ce8e21c2721b9c4e096c0a2cf4571972b03fdc7)