Put call to MAX in the right scope.