fixed a bug in the derivatives module and improved unit test