move class_eval back inside if