Changed file in stream opening function