fixing gross min max bug