improved different_target conditions
Merge pull request #8826 from acapilleri/different_target

Improved different_target conditions