Fix NPE regression of commit ba1ffe66697c3175b423cb7ab9b686d73959708d