a bug that sometimes causes shell to hang if shell is restarted

Signed-off-by: Tolga HOŞGÖR <fasdfasdas@gmail.com>