[Refactor] Various compatibility fixes for clang