added max callback depth check