fixed some issues in topology building logic.