Delaying the set of session.dhandle introduced a NULL dereference
bug, fix it.