fixed and tested dot product