Fixed the save and delete functions