Fixed error in connectedComponents-Algorithm