Use write_flags