Do readlink earlier for symlink detection