fixed the case when one of the vectors has length 0!