improvements in ssid handling; added db indexes