fixing errors in scripts with console.log