fix some windows and made flattenStructs smarter