Fix vector out of bounds in script tests

Fixes references to the one-past-buffer position in std::vector, introduced in #4960.