diff --git a/src/Models/Model.php b/src/Models/Model.php
index <HASH>..<HASH> 100644
--- a/src/Models/Model.php
+++ b/src/Models/Model.php
@@ -125,6 +125,9 @@ class Model
         return $value;
     }
 
+    /**
+     * @return string
+     */
     public function toJson()
     {
         return json_encode($this->toArray());
diff --git a/src/Resources/QueriableResource.php b/src/Resources/QueriableResource.php
index <HASH>..<HASH> 100644
--- a/src/Resources/QueriableResource.php
+++ b/src/Resources/QueriableResource.php
@@ -76,8 +76,8 @@ class QueriableResource extends JsonResource implements QueriableResourceInterfa
      */
     protected function transform(stdClass $data, $className = null)
     {
-        $data = !empty($className) ? $data : $this->getFirstProperty($data);
         $name = !empty($className) ? $className : $this->getFirstPropertyName($data);
+        $data = !empty($className) ? $data : $this->getFirstProperty($data);
         $class = '\\Pokemon\\Models\\' . ucfirst(Inflector::singularize($name));
         if (class_exists($class)) {
             /** @var Model $model */
Fixed a bug wine querying a card or set by identifier