This fixes #776. Recursion is not needed, as the permissions will only need to be set on the first invocation.