unit test and small fixes in dbfile for lower case resi in db