added try catch to handle previous broken logic