Remove use of define_singleton_method.

For 1.8 compatibility.