debugging infinite loop