more robust way to get task ids right