fix exception handlings.