fix li'l bug in max