guard against zero-length vectors