added a set number of tries when inserting into the sqlite database for Ks values