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.
Good point. It can not be done efficiently with pointers because they have different types. And toBytes creates a temporary object. So you still have to introduce a copy operation. I will include the memcpy in the  switch case, this avoids the copy operation.