fix possible infinite loop on require error