SObject - Depth dinamized and minor fix

Added the possibility to change the max depth in the SObject.
Also fixed the depth check.