amend directory walking function (again)