fix: clear directory before generation of context

fixes #927
Merge pull request #1001 from russkel/issue927

fix: clear directory before generation of context