Fix export in tabular format and add tests