some bug fix on C++