In if statements,the remainding part after break is not executed