harden up symlink code