serialize keys before calling append