fix loop edges