fix derivative_W_sparse