Fix #257 - Ensure paths exist before using them

- Also, fix assertions
Merge pull request #260 from my-personal-forks/fix-257-paths

Fix #257 - Ensure paths exist before using them