Fixing some bad behavior in layouts