cres_in_range(), fix index variable