improve db file handling