add 10-6: safe open function