Fix the condition of case 3 and 4.