Fix reduce maximum for large grid sizes