added a better Wait for tasks method.  fixed a bug in clone()