write to named pipe, plus expect regex fixes