fixed need_writer bug