Fix `bEnd` ReferenceError

Use `var` when assigning to `bEnd` variable.