fix a bug that crashes connectivity calculation