Fixed an issue with running a script on the right terminal window