fixed UACalc file writing function