Check for class existence and type by ID