fixed minor bugs in cpp wrappers