fix bug on non-interactive shells