Alternative fix for #246 NPE.