do you also need to set nd->length = 0 ?