Trying to fix issues with the saveData function