attempt to correct problems on nonexistent indices, see #4
sorted access to database tables