fixing writer thread