using lstat instead of stat and updating tests