Fixed external tools not running issue

Also removed some debug code