added write-string non-blocking implementation