added a try catch to sqlite code