fixes layout switching error