have bugs with c++ memory management