avoiding infinite loop

without initialisation, infinite loop can appear