diff --git a/teavm-core/src/main/java/org/teavm/vm/TeaVM.java b/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
index d451337b7..08b119247 100644
--- a/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
+++ b/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
@@ -438,7 +438,7 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
                 sourceWriter.append("var ").append(entry.getKey()).ws().append("=").ws();
                 boolean wrapAsync = !asyncMethods.contains(entry.getValue().reference) && entry.getValue().isAsync();
                 if (wrapAsync) {
-                    sourceWriter.append("$rt_asyncAdapter(");
+                    sourceWriter.append("$rt_staticAsyncAdapter(");
                 }
                 sourceWriter.appendMethodBody(entry.getValue().reference);
                 if (wrapAsync) {
diff --git a/teavm-core/src/main/resources/org/teavm/javascript/runtime.js b/teavm-core/src/main/resources/org/teavm/javascript/runtime.js
index d81aeb0fa..8b358abe8 100644
--- a/teavm-core/src/main/resources/org/teavm/javascript/runtime.js
+++ b/teavm-core/src/main/resources/org/teavm/javascript/runtime.js
@@ -459,6 +459,19 @@ function $rt_asyncError(e) {
         throw e;
     }
 }
+function $rt_staticAsyncAdapter(f) {
+    return function() {
+        var result;
+        var args = Array.prototype.slice.apply(arguments);
+        var $return = args.pop();
+        try {
+            result = f.apply(this, args);
+        } catch (e) {
+            return $return($rt_asyncError(e));
+        }
+        return $return($rt_asyncResult(result));
+    }
+}
 function $rt_asyncAdapter(f) {
     return function() {
         var result;