The isKnownNonZero() function have checks that abort the recursion when
it reach the specified max depth. However one of the recursive calls was
placed before the max depth check was done, resulting in a endless
recursion that eventually triggered a segmentation fault.
Fixed the problem by moving the max depth check above the first
recursive call.