workaround for dissapearing c++ objects