altered open function