fix pattern match