fix bug when mixing keyed and unkeyed elements