Fix logic error where previous match captures would be used.