You probably just need to check that `corr_first >= 0 and corr_last >= corr_first and corr_first < count`, the rest comes by inference.