Fixed issues with sqlite3 syntax