some bulletproofing added when database appears corrupted or changed