corrected the update formula