Fix remove flex attr

Fix and test case for #779