Guard against invalid paths in walk