Fix handling of rmin and rmax.