Revert "use readlink"

This reverts commit 0719946414b62c966559bb951b7e02e83d6ab72e.