refactor put
refactor inputstream