fixed flag bug in cov loop old