working out sqlite3 problem