bug fix

changed try catch to a better if statement