fix compile error for class function returning custom type
add metatableregistry to object functions