fixed a bug in calcualting spanning tree parent, which looks like an ancient bug...