fix some CPP-style bugs