fix bug in latmio_und_connected for sparse matrices