found a memory bug, caused by class slicing machanics in c++