fixed small bug in the line search section (weight got divided by two after diff was computed