ensure base and parent dirs

Theres a bug where the parent dir isn't available, and we assume it is. This fixes that.