updating error in algorythm