Fixed a bug saving data modified by dataToDatabase