Fix bug when serializing lists with nulls inside.