enhanced the scoobi script to avoid messing up the terminal on exit