targetShapeIndex fix for bug prevention