Refactor the mirror script call.
Fix bug when groups are created.