fixed most of potential harmful warnings generated by clang++ and -Weverything option