re-fixing dual loop problem