fix derivative issue