fix wildcards and group encoding problems

fix issues #1 and #2