Added a workaround for race conditions with files.
Merge pull request #165 from TobiasKipp/master

Added a workaround for race conditions with files.
Merge pull request #166 from kalxas/master

Added missing initializations (thanks Matej Krejci)