Fixed matrix concatenation bug