better readlink, mac compatible