bug in pattern-matching?