fix bugs in multinom optimization