pattern match bugfix