overlay: use lstat rather than stat and make sure there are no trailing spaces