added some arg_max checking