modified vector_dotproduct to properly work in parallel