updated hash stdin handling