Fixed compile bugs uncovered with Clang