generalized previous commit: if target type is just a class, use the
target object's class to improve the detected class