Clang compatibility

Fixed misc clang compatibility issues.