Fixing the DCG building process

Now tasks have ids equal to the order they would execute if there were
no threads