diff --git a/examples/CreateAndSignTx.js b/examples/CreateAndSignTx.js
index ede5a78..32990e6 100644
--- a/examples/CreateAndSignTx.js
+++ b/examples/CreateAndSignTx.js
@@ -59,11 +59,13 @@ var run = function() {
console.log('TX HEX IS: ', txHex);
};
-// browser example compatibility
-if (module) {
+// This is just for browser & mocha compatibility
+if (typeof module !== 'undefined') {
module.exports.run = run;
-}
-if (require.main === module) {
+ if (require.main === module) {
+ run();
+ }
+} else {
run();
}
diff --git a/examples/example.html b/examples/example.html
index 3fdd089..74a1f64 100644
--- a/examples/example.html
+++ b/examples/example.html
@@ -14,9 +14,9 @@
-