fixes #1407 parent directory created if it does not exists.

Fix for the issue #1407.