use console.log instead of stdout.write