Fixed a number of issues for successful compilation with Clang.