added break in if loop