Fix layout for matrix