min max not working