Fix bug causing the DB not to update