remove undef usage in document_proxy and use define_method instead