fix detection of missing target. thanks to thomas.