add min max values to prevent wrong values