fix vm overflow

I hope those are the last overflow bugs in the vm. The tests cause the client to crash with a segmentation fault, this PR fixes that.
Also included the performance tests from Artur.
(I had to recreate this PR because I accidently pushed some unrelated changes in this branch)
I dont see how this could happen.