Fixed bugs with vector algebra.