Fixes on dtree lookup and added function to get path for dtree entry.
There is still some bug causing persisted dtree entries to fail randomly and
also that persited array has constant size and is expected to be large enough by now.