use define_singleton_method instead of class_eval