-fixing the update routine.