Corrected handling of stack (refs #194).