Bug fixes relating to readline hangs