Backport gamma change/fix from e627fc1 to maintenance.