fix loop detection and readme