simplify readlink logic