bugfix on layout switching