extend to 3-cards matching mode and fix previous bugs