added try catch to catch the error