fixed error in the loops (-l)