replaced a try/catch