fix possible numerical instability problem
arg