Fixed a recursion bug and a few minor issues.
Merge pull request #129 from maksimov/2014.03

Fixed a recursion bug and a few minor issues.