small fix with discretiezation (max --> min)