fixes #13: ignore EEXIST for mkdir and add tests

Fix to ignore EEXISTS errors

Refactor a bit to be able to introduce tests against the underlying methods.