Added a try-catch to catch the context exception