bug fix for get rid of max and min