Create output directory if it doesn't exist.

- fix error reported in #152