flatten fixes