Fix task update logic