diff --git a/lib/classes/JsonApi/Schemas/Course.php b/lib/classes/JsonApi/Schemas/Course.php
index 29a0c376380e0f28c5d6c20fb340110c2edf27a9..b6fe04a63b49f3bc2d19058e47eef6135b9b75df 100644
--- a/lib/classes/JsonApi/Schemas/Course.php
+++ b/lib/classes/JsonApi/Schemas/Course.php
@@ -399,10 +399,14 @@ class Course extends SchemaProvider
 
     /**
      * @inheritdoc
+     *
+     * @param \Course $resource
      */
     public function getResourceMeta($resource)
     {
-        $avatar = \CourseAvatar::getAvatar($resource->id);
+        $avatar = $resource->isStudygroup()
+                ? \StudygroupAvatar::getAvatar($resource->id)
+                : \CourseAvatar::getAvatar($resource->id);
 
         return [
             'avatar' => [
diff --git a/tests/jsonapi/CourseShowTest.php b/tests/jsonapi/CourseShowTest.php
index e1acf9255b4e3dd9629490ad98a0064e469fc262..d2c953cee7f0a628f9e2c4baeb2a839bd9cdbb37 100644
--- a/tests/jsonapi/CourseShowTest.php
+++ b/tests/jsonapi/CourseShowTest.php
@@ -13,6 +13,9 @@ class CourseShowTest extends \Codeception\Test\Unit
     protected function _before()
     {
         \DBManager::getInstance()->setConnection('studip', $this->getModule('\\Helper\\StudipDb')->dbh);
+        //Initialize $SEM_TYPE and $SEM_CLASS arrays
+        $GLOBALS['SEM_CLASS'] = SemClass::getClasses();
+        $GLOBALS['SEM_TYPE'] = SemType::getTypes();
     }
 
     protected function _after()
diff --git a/tests/jsonapi/CoursesByUserTest.php b/tests/jsonapi/CoursesByUserTest.php
index 99474053b14550de18d387d546346a470c596927..00307a79f9e48e6c75363567450b548e10da59ce 100644
--- a/tests/jsonapi/CoursesByUserTest.php
+++ b/tests/jsonapi/CoursesByUserTest.php
@@ -13,6 +13,9 @@ class CoursesByUserTest extends \Codeception\Test\Unit
     protected function _before()
     {
         \DBManager::getInstance()->setConnection('studip', $this->getModule('\\Helper\\StudipDb')->dbh);
+        //Initialize $SEM_TYPE and $SEM_CLASS arrays
+        $GLOBALS['SEM_CLASS'] = SemClass::getClasses();
+        $GLOBALS['SEM_TYPE'] = SemType::getTypes();
     }
 
     protected function _after()