bug in u_opt and d_opt