fixed for non connected and matrix mult