bug in loss loop counter