Added dinamization of the max depth allowed
Fixed depth check.
 - It was checking number of childrens and no depth of object. Infinite depth allowed