updating min and max gain