improve mixed pattern handler