fixed keyvaluepairs in writing files

Exception was thrown before, because for loop over dictionary only
returns key during the loop. Values would have to be extracted manually
from dictionary using get()
Use of .items() makes old construct possible
Merge pull request #8 from yanlend/master

fixed keyvaluepairs in writing files