fix 8 compiler errors in cpp