Fix bugs in updating existing tasks