more numerical stable

first take log, then exp()