fixed issues #3 and #4: output buffer always wrote the whole buffer to the socket instead of just the new data