prevent infinite-loops when loading mercury editor
Merge pull request #352 from trongrg/fix_infinite_loops

prevent infinite-loops when loading mercury editor