loop counting bug fixed
interface