fix the bug that the wrong of compute the maximum