Fixed derivative calculation
Fixed derivative calculation