This if block should be outside the try block