Fix saving to database.