removing infinite loop