Don't let nesting count go below zero.  Resolves issue #523.
More checks to make sure nesting level doesn't go below zero.  Issue #523.
Merge pull request #644 from dpvc/issue523

Resolves issue #523