fix bugs on flex layout model