Fixed vector subscript out of range