fixed exception catching, deadlock issue