Fix cell type writing