fix max's bug