fix layout switching