cleaned up whitespace, better errors to matrix (de)serialization