Improving url_stat for directories and files