Some c++ fixes