Fix for pattern type checking