fixed the bugs in loops assumption