some js improvements from ndef-js