changed catch to if