adding try-catch block.