Fix edgeCount error, add better tests for it.