fixed save and open function bugs