reorganize try block for test generation