corrected deriv bug for NSRef, order 2 seems ok but failure for order 3