Merge bug fix (min -> max)