fixed the layout switch issue