fixing some issue with the connectivity matrix