fix cloning when undefined present in tree