infinite loop issue fixed