Only compute derivative in z on demand for long_step