wrap timed loops with try block to catch timeout