Fix a bug when creating nested maps and arrays