fixing updating sigma algorithm and update sigma error