Fix regression when serializing flattened lists in EC2 protocol.

Fixes #403