added a try catch