Revert "Use Path.get instead of Path.isValid"

This reverts commit 0ac6e7d58d536aa58c8733abeafddc80ced73feb.