properly update branch variable after removing nils from vr

Bug fix: the branch variable (an index into the array vr) was not properly updated after nils were removed from vr. This caused an array-out-of-bounds panic at the following line:

```
 	case 1:
  		match = vr[branch]
```