A few bugfixes around the nderiv function