Merge pull request #111 from treydock/flows
Improve handling of realm flow assignment to avoid errors