better task update logic