fix some bugs introduced by clang restructuring