correctly calculate vector operations for 2d vectors

I noticed that the implementation of the `add` and `dot` operation were incorrect for 2 dimensional vectors. I created tests to expose the problems and provided a implementation that passes the tests.