Fixed writechannel bug as described in ticket in #246, now closed