bugfix in getFirstMatch