This fixes 8173, if target was not defined it would break, now it wont

This fixes #8173, if target was not defined it would break, now it wont