fixed some errors for CPP compiler