Fix matrix resize