fixed bug introduced in flattened errors function