diff --git a/libraries/ghc-internal/jsbits/base.js b/libraries/ghc-internal/jsbits/base.js
index 9c06cd2702a143074cf302710bfe6765ea1ad95d..62a5cb683e9982a532a7975cab6280f8cdfd445e 100644
--- a/libraries/ghc-internal/jsbits/base.js
+++ b/libraries/ghc-internal/jsbits/base.js
@@ -912,7 +912,7 @@ if(h$isNode()) {
     }
 } else if(h$isJsCore()) {
     h$base_readStdin = function(fd, fdo, buf, buf_offset, n, c) {
-	c(0);
+        c(0);
     }
     var h$base_stdoutLeftover = { f: print, val: null };
     var h$base_stderrLeftover = { f: debug, val: null };
diff --git a/libraries/ghc-internal/jsbits/platform.js b/libraries/ghc-internal/jsbits/platform.js
index 2ecdee2189a5d33ed8eeec7505fbaae518f62ae0..89f1fa18395a846fb91186f8235e0d9c44c73276 100644
--- a/libraries/ghc-internal/jsbits/platform.js
+++ b/libraries/ghc-internal/jsbits/platform.js
@@ -76,7 +76,7 @@ if(typeof process !== 'undefined' && (typeof h$TH !== 'undefined' || (typeof req
       }
     }
     var h$processConstants = h$getProcessConstants();
-} else if(typeof Java !== 'undefined') {
+} else if(typeof Java !== 'undefined' && typeof java !== 'undefined') {
     h$isJvm_ = true;
     this.console = {
       log: function(s) {
diff --git a/rts/js/profiling.js b/rts/js/profiling.js
index e6433e36d6cb63ad7080f81caf8af16babf2886f..6ac32912a46c6c9b421abdfc506b3f82f94227ae 100644
--- a/rts/js/profiling.js
+++ b/rts/js/profiling.js
@@ -1,6 +1,6 @@
 //#OPTIONS: CPP
 
-// Used definitions: GHCJS_TRACE_PROF and GHCJS_ASSERT_PROF
+// Used definitions: PROFILING and GHCJS_ASSERT_PROF
 
 #ifdef GHCJS_ASSERT_PROF
 function assert(condition, message) {
@@ -13,7 +13,7 @@ function assert(condition, message) {
 #define ASSERT(args...)
 #endif
 
-#ifdef GHCJS_TRACE_PROF
+#ifdef PROFILING
 #define TRACE(args...) { h$log(args); }
 #else
 #define TRACE(args...)
@@ -140,7 +140,7 @@ var h$CAF           = new h$CCS(h$CCS_MAIN, h$CAF_cc);
 // Cost-centre entries, SCC
 //
 
-#ifdef GHCJS_TRACE_PROF
+#ifdef PROFILING
 function h$ccsString(ccs) {
   var labels = [];
   do {
@@ -151,6 +151,7 @@ function h$ccsString(ccs) {
 }
 #endif
 
+#ifdef PROFILING
 function h$pushRestoreCCS() {
     TRACE("push restoreccs:" + h$ccsString(h$currentThread.ccs))
     if(h$stack[h$sp] !== h$setCcs_e) {
@@ -159,6 +160,7 @@ function h$pushRestoreCCS() {
         h$stack[h$sp]   = h$setCcs_e;
     }
 }
+#endif
 
 function h$restoreCCS(ccs) {
     TRACE("restoreccs from:", h$ccsString(h$currentThread.ccs))
@@ -299,7 +301,7 @@ function h$buildCCPtr(o) {
   // last used offset is 12, so we need to allocate 20 bytes
   ASSERT(o !== null)
   var cc = h$newByteArray(20);
-#ifdef GHCJS_TRACE_PROF
+#ifdef PROFILING
   cc.myTag = "cc pointer";
 #endif
   PUT_ADDR(cc, h$ccLabel_offset,  h$encodeUtf8(o.label),  0);
@@ -312,7 +314,7 @@ function h$buildCCSPtr(o) {
   ASSERT(o !== null)
   // last used offset is 8, allocate 16 bytes
   var ccs = h$newByteArray(16);
-#ifdef GHCJS_TRACE_PROF
+#ifdef PROFILING
   ccs.myTag = "ccs pointer";
 #endif
   ccs.arr = [];