fix c++ errors, etc