Fix some of the derivatives. Add a test.