Some dir ensure / file security checks
Change file owner per feedback
Merge pull request #251 from nhr/file_handling_updates

Some dir ensure / file security checks