little improve in the pattern matching