Handles some corner cases in vector math