fix for #336

- improve path handling, see issue #336