diff --git a/compiler/GHC/StgToJS/Linker/Utils.hs b/compiler/GHC/StgToJS/Linker/Utils.hs
index de66e96be4ce38407fe928c743c6b995bf7de8a8..b5b28a77ca81bf876a7bc488301b38f63476ef1c 100644
--- a/compiler/GHC/StgToJS/Linker/Utils.hs
+++ b/compiler/GHC/StgToJS/Linker/Utils.hs
@@ -140,7 +140,7 @@ genCommonCppDefs profiling = mconcat
 
   -- Put Addr# in ByteArray# or at Addr# (same thing)
   , "#define PUT_ADDR(a,o,va,vo) if (!(a).arr) (a).arr = []; (a).arr[o] = va; (a).dv.setInt32(o,vo,true);\n"
-  , "#define GET_ADDR(a,o,ra,ro) var ra = (((a).arr && (a).arr[o]) ? (a).arr[o] : null_); var ro = (a).dv.getInt32(o,true);\n"
+  , "#define GET_ADDR(a,o,ra,ro) var ra = (((a).arr && (a).arr[o]) ? (a).arr[o] : null); var ro = (a).dv.getInt32(o,true);\n"
 
   -- Data.Maybe.Maybe
   , "#define HS_NOTHING h$ghczminternalZCGHCziInternalziMaybeziNothing\n"
diff --git a/compiler/GHC/StgToJS/Prim.hs b/compiler/GHC/StgToJS/Prim.hs
index 54be388b4d2490f1e9d0cd6f3e493b42abc3cb96..60c52d5662ff92f707deb62c175e2f29db67ee26 100644
--- a/compiler/GHC/StgToJS/Prim.hs
+++ b/compiler/GHC/StgToJS/Prim.hs
@@ -940,7 +940,7 @@ genPrim prof bound ty op = case op of
 ------------------------------- Delay/Wait Ops ---------------------------------
 
   DelayOp     -> \[] [t]  -> pure $ PRPrimCall $ returnS (app "h$delayThread" [t])
-  WaitReadOp  -> \[] [fd] -> pure $ PRPrimCall $ returnS (app "h$waidRead" [fd])
+  WaitReadOp  -> \[] [fd] -> pure $ PRPrimCall $ returnS (app "h$waitRead" [fd])
   WaitWriteOp -> \[] [fd] -> pure $ PRPrimCall $ returnS (app "h$waitWrite" [fd])
 
 ------------------------------- Concurrency Primitives -------------------------
diff --git a/compiler/GHC/StgToJS/Rts/Rts.hs b/compiler/GHC/StgToJS/Rts/Rts.hs
index 2297ec60bea77b067a983c01c7a16af17a207a59..4f5e5e5f8545c74849395ab745162281df6855bd 100644
--- a/compiler/GHC/StgToJS/Rts/Rts.hs
+++ b/compiler/GHC/StgToJS/Rts/Rts.hs
@@ -371,7 +371,8 @@ rts_gen s = do
               , global "h$ct_stackframe" ||= toJExpr StackFrame
               , global "h$vt_ptr"    ||= toJExpr PtrV
               , global "h$vt_void"   ||= toJExpr VoidV
-              , global "h$vt_double" ||= toJExpr IntV
+              , global "h$vt_int"    ||= toJExpr IntV
+              , global "h$vt_double" ||= toJExpr DoubleV
               , global "h$vt_long"   ||= toJExpr LongV
               , global "h$vt_addr"   ||= toJExpr AddrV
               , global "h$vt_obj"    ||= toJExpr ObjV
diff --git a/rts/js/gc.js b/rts/js/gc.js
index eacb58c7990b774faaecde39f7437a1997684657..a06ca4511510b7fee7f2e102dca67a82d449497d 100644
--- a/rts/js/gc.js
+++ b/rts/js/gc.js
@@ -76,7 +76,7 @@ var h$retainCAFs = false;
 // var h$CAFs = [];
 // var h$CAFsReset = [];
 
-// 
+//
 var h$extensibleRetentionRoots     = [];
 var h$extensibleRetentionCallbacks = [];
 
@@ -206,7 +206,7 @@ function h$gc(t) {
 	h$markThread(nt);
 	h$resetThread(nt);
     }
-    
+
     // some blocked threads are always considered reachable, mark them
     //   - delayed threads
     //   - threads blocked on async FFI
@@ -531,6 +531,7 @@ function h$follow(obj, sp) {
                     extensibleMatched = true;
 #endif
                     if(x !== true) {
+                      var j;
                       for(j=x.length-1;j>=0;j--) {
 		          ADDW(x[j]);
 		      }
diff --git a/rts/js/mem.js b/rts/js/mem.js
index 3217abfe41c20818be03c1ec01974ed2c056ba05..3baf27ef759cbbd0689cc92500df2d50aab5cf23 100644
--- a/rts/js/mem.js
+++ b/rts/js/mem.js
@@ -1546,7 +1546,8 @@ function h$initHeapBufferLen(buf_d, buf_o, len) {
 // Allocate and copy a JS buffer on the heap
 function h$initHeapBuffer(str_d, str_o) {
   if(str_d === null) return null;
-  return ptr = h$initHeapBufferLen(str_d, str_o, str_d.len);
+  var ptr = h$initHeapBufferLen(str_d, str_o, str_d.len);
+  return ptr;
 }
 
 
diff --git a/rts/js/string.js b/rts/js/string.js
index 4797cb13b5eaaa370082589dd42e737611141adc..83f8fb03f19dd06265962539dae83eeaef625f5c 100644
--- a/rts/js/string.js
+++ b/rts/js/string.js
@@ -479,9 +479,9 @@ function h$decodeUtf16z(v,start) {
 
 function h$decodeUtf16l(v, byteLen, start) {
   // perhaps we can apply it with an Uint16Array view, but that might give us endianness problems
-  var a = [];
+  var arr = [];
   for(var i=0;i<byteLen;i+=2) {
-    a[i>>1] = v.dv.getUint16(i+start,true);
+    arr[i>>1] = v.dv.getUint16(i+start,true);
   }
   return h$charCodeArrayToString(arr);
 }
@@ -590,7 +590,7 @@ function h$charCodeArrayToString(arr) {
 }
 
 function h$hs_iconv_open(to,to_off,from,from_off) {
-  h$errno = h$EINVAL; // no encodings supported
+  h$setErrno("EINVAL"); // no encodings supported
   return -1;
 //  var fromStr = decodeUtf8(from, from_off);
 //  var toStr = decodeUtf8(to, to_off);