fix pattern bug