Reintroduced extglob, as removing it was wrong (was needed in version check).
match_count variable was not initialized.