updated to fix bug when user updates max/min