clean up rule matching