Revert "Removed calls to ensurePath"

This reverts commit 5c3c99e5db223ea2a26a4134dfba015275cbb9e1.