clang support: first bunch of fixes