Adding try condition so error is not invoked