changed db.update to db.save