added serialization
fixed bug with matrix-from-vectors build