Added returning NULL code to dned functions.

Then this program runs correctly in X=4.
But it is too slow. The cause may be debug printings.
X=5 is not tested yet.