Fix Matrix and Grid initialization