Corrected end number in update function.