the problem happens when runs to next if statement in original code.