               register(obj[k], restrict[k])
         return
       return nativeMetadata[obj.__mdid__] = new ObjectMetadata(obj)
+
+    getPrototypeOf = (obj) ->
+      if hasProp(obj, '__mdid__')
+        proto = nativeMetadata[obj.__mdid__].proto
+      else if hasProp(obj, '__md__')
+        proto = obj.__md__.proto
+      if proto
+        return proto
+      return prototypeOf(obj)
 
     getOwnPropertyDescriptor = (obj, key) =>
 

   
    nativeMetadata[Object.__mdid__].properties = {
      create: create
      getPrototypeOf: prototypeOf
      defineProperty: defineProperty
    }


    }

    # retrieves the metadata from the closest object in the prototype chain
    # that has a metadata object associated
    @mdproto = (obj) ->
      proto = prototypeOf(obj)
      if proto
