Fixed from_matrix according to the suggestion in #32.