diff --git a/lib/index.js b/lib/index.js
index 7a0c8615411e7d608b92ad7bf336fbb5910dbae7..50627f6491376ae26b47901e7bcd20bf9db3fb1c 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -9,6 +9,7 @@ var path = require("path"),
     worker = path.join(__dirname, "worker.js"),
     events = /^(error|message)$/,
     defaultPorts = { inspect: 9229, debug: 5858 };
+var forkedChilds = 0;
 
 var Worker = function () {
 	function Worker(arg) {
@@ -34,7 +35,7 @@ var Worker = function () {
 		if (debugVars.length > 0 && !options.noDebugRedirection) {
 			if (!options.execArgv) {
 				//if no execArgs are given copy all arguments
-				debugVars = process.execArgv;
+				debugVars = Array.from(process.execArgv);
 				options.execArgv = [];
 			}
 
@@ -58,7 +59,8 @@ var Worker = function () {
 				if (match[2]) {
 					port = parseInt(match[2]);
 				}
-				debugVars[portIndex] = "--" + match[1] + "=" + (port + 1); //new parameter
+				debugVars[portIndex] = "--" + match[1] + "=" + (port + 1 + forkedChilds); //new parameter
+				forkedChilds++;
 
 				if (debugIndex >= 0 && debugIndex !== portIndex) {
 					//remove "-brk" from debug if there
diff --git a/src/index.js b/src/index.js
index cd9e6f39d446b59fa9c7479963e80d3f5c0b2ec1..f18b2b7551b986ce5d7632b044ec4c2d9bd6149e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -3,6 +3,7 @@ const path = require("path"),
 	worker = path.join(__dirname, "worker.js"),
 	events = /^(error|message)$/,
 	defaultPorts = {inspect: 9229, debug: 5858};
+let forkedChilds = 0;
 
 class Worker {
 	constructor (arg, args = undefined, options = {cwd: process.cwd()}) {
@@ -19,7 +20,7 @@ class Worker {
 		});
 		if (debugVars.length > 0 && !options.noDebugRedirection) {
 			if (!options.execArgv) { //if no execArgs are given copy all arguments
-				debugVars = process.execArgv;
+				debugVars = Array.from(process.execArgv);
 				options.execArgv = [];
 			}
 
@@ -39,7 +40,8 @@ class Worker {
 				if (match[2]) {
 					port = parseInt(match[2]);
 				}
-				debugVars[portIndex] = "--" + match[1] + "=" + (port + 1); //new parameter
+				debugVars[portIndex] = "--" + match[1] + "=" + (port + 1 + forkedChilds); //new parameter
+				forkedChilds++;
 
 				if (debugIndex >= 0 && debugIndex !== portIndex) { //remove "-brk" from debug if there
 					match = (/^(--debug)(?:-brk)?(.*)/).exec(debugVars[debugIndex]);