Fixed bugs in toKingdomeTree implementation