prevent error out of index