fix. logic to account for empty targets.

Change-Id: I253159f111bcb4c54cb6cf9ccc3940e1a4089dc8