fixing average, and making min and max.sh