fixes for writer and clang compilation