added valid target check