fixed error in CVAdists due to rewriting and wrongly assigned variable; removed unused variables in some other functions