adjusted write_cell_basis