Fix roi range bug

Fix value or ROI range when it is too big.