Fix : Keys may return unsorted keys, max is necessary