replace call to MAX with GREATEST

Change-Id: I9ff1b796d0da07918ed0cdb53b6355ddb6e5b884