Clean up Some warnings and errors to compile with clang on macos