avoiding sqlite3 exceptions