Thanks for the hint. I figured out the problem. I assign input.data() to a pointer and then being to careful, I unconsciously freed this pointer in the destructor of the input class. I am not sure why it affects the output though, but after commenting this part, it works!