fix bug while merging Jara's work
 - set output stream descriptor for hnd