faster matching, bugfixes