fixed some minor-bug dected by cppcheck