Fix writeAndFlush to write