fix generating xml object in spmatrix