Correcting bad loop