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 will add an exception. Technically it can not be reached right now, but I added it because you get a lot of compiler warnings for unchecked cases.