Fixed a bug related with dataToDatabase