Use stat instead of lstat so we treat symlinks correctly.