correct handling of wildcards in opendir function