Using class_eval instead of define_class to keep backward compatibility with ruby < 1.9.x