changed wildcard escape logic

same change as merged pull request #382 from alkalinecoffee/master