fixes for directories and streams