diff --git a/VERSION b/VERSION
index 0d91a54c7d439e84e3dd17d3594f1b2b6737f430..9e11b32fcaa96816319e5d0dcff9fb2873f04061 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3.0
+0.3.1
diff --git a/pirati.php b/pirati.php
index 01029446681968e94e876ecaf8b5368c26e1f704..42fa50fc672de43a34f78d8f572ffad3743d5a34 100644
--- a/pirati.php
+++ b/pirati.php
@@ -77,10 +77,10 @@ class pirati extends \phpbb\auth\provider\oauth\service\base
     }
 
 
-    function octopussy_callback()
+    function octopussy_callback( $uid )
     {
         $ch = curl_init();
-        curl_setopt($ch, CURLOPT_URL, "https://chobotnice.pirati.cz/import-person/" . $result['sub'] . "/");
+        curl_setopt($ch, CURLOPT_URL, "https://chobotnice.pirati.cz/import-person/" . $uid . "/");
         curl_exec($ch);
         curl_close($ch);
     }
@@ -120,7 +120,7 @@ class pirati extends \phpbb\auth\provider\oauth\service\base
                 throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_RETURN_ERROR');
         }
 
-        octopussy_callback();
+        $this->octopussy_callback($result['sub']);
         return $result['sub'];
 
     }
@@ -149,7 +149,7 @@ class pirati extends \phpbb\auth\provider\oauth\service\base
                 throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_RETURN_ERROR');
         }
 
-        octopussy_callback();
+        $this->octopussy_callback($result['sub']);
         return $result['sub'];
 
     }