some index checking for do arrays