Fix: more reliable way of finding the class name