fixes #9 - throws exception when directory is not writable