Fixes race condition in resources

See #1378.
Replace this for-loop with ``in_group.update(res_group=new_group)`` for greater efficiency.