[lib] fixed wrong param to write, must have thought it was a callback