From process.stdout.on to process.stdout.once
Added more error logs