fix  flatten