Adds object_exists function to make it work with interfaces and traits