keys can now also be removed when writing to a file