bugfixed saving data