add assert to check if id<0 in getTask