Fix for not flattening secondaries incorrectly.