hack for dealing with inevitable thread interruptions.