fix scripts and make code compatible with old clang