some fixes + fixed clang build