improved PrefixWriter