removed console.stacktrace that should be replaced with err.stack where appropriate