Fixes the way we check if flattening happened during