Fixing fstreams sharing