Fix bounds check in ByIdArray