Limit maximum nesting depth (issue reported by Jeff Larson)