Fixing a bug with the update code