supports cycles in maps and fixes #521
Merge pull request #523 from bitovi/cycles-in-maps

supports cycles in maps and fixes #521