fixed main and matrix files