fix some bug in max entropy