move the stat check to the stream open function