corrected some bugs on the sqlite datastore