Fixed artifacts when changing the threshold mid-computation.