add keep_id support in to_dict method