fix a reg allocation bug; add function angleVec(not fully tested);