added support for unflattening before unparsing