fixed the vectorize method