Fixing exception handling in peer thread