Fixed wrong dot product calculation