Replace define_method by eval