fixed bug when dead session causes unexpected output