fix the loop problem
fix loop problem and merge