fixing so it works.

Fixing dependencies.
Fixing mkdir fail when the dir already exists.