Fixed bug in data saving.