using sqlite, fixing error in sqlite, and improving js