fixed value_to function to add last target