fixed a bug in cpp handling