Add missing out-of-range checks (mp::wait).