Fixing issue where index is undefined in count method of vbox

Had an issue where the index variable was throwing an undefined error a in Chrome.

This seems to have fixed the issue for me so please consider taking this pull request if it makes sense to you.