Make sure target index exists before setting target