diff --git a/gi/object.c b/gi/object.c
index 0941fae..b93892c 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -1546,6 +1546,21 @@ gjs_object_from_g_object(JSContext    *context,
 
         proto = gjs_lookup_object_prototype(context, G_TYPE_FROM_INSTANCE(gobj), (GIObjectInfo*) info);
 
+        if (proto) {
+            ObjectInstance *proto_priv;
+
+            proto_priv = priv_from_js(context, proto);
+            if (proto_priv && proto_priv->info &&
+                g_strcmp0(g_base_info_get_name((GIBaseInfo*) proto_priv->info),
+                          g_base_info_get_name((GIBaseInfo*) info)) != 0) {
+
+                g_warning("Have mismatch of prototype's type  and required type.");
+
+                g_base_info_unref( (GIBaseInfo*) info);
+                info = NULL;
+            }
+        }
+
         /* can't come up with a better approach... */
         unthreadsafe_template_for_constructor.info = (GIObjectInfo*) info;
         unthreadsafe_template_for_constructor.gobj = gobj;
@@ -1553,7 +1568,8 @@ gjs_object_from_g_object(JSContext    *context,
         obj = gjs_construct_object_dynamic(context, proto,
                                               0, NULL);
 
-        g_base_info_unref( (GIBaseInfo*) info);
+        if (info)
+            g_base_info_unref( (GIBaseInfo*) info);
 
         g_assert(peek_js_obj(context, gobj) == obj);
     }
