fixed calculation of entries to delete. Also updated the retrieval of existing keys, now all entries are fetched and the list is not limited to entries of the source file.