Bugfix in auto open function