Add missing wait_for { ready? } blocks.
Looks like you have to add access rules one by one.
Updates to the full example script.