Fix error with open stream