Add try catch to prevent uncatched exception