Bug solved when creating a vector from another and full example code