patched to use new NPN API