Fixed a big error in indexes in function vectorselection