Fix for stack overflow
Merge pull request #725 from BryanHunt/master

Fix for issue #722