fix bugs in mac clang++ compiler.