bug fixing for min max output