now throwing exception when encountering invalid topology