Fix callbacks in loops
Merge pull request #8 from WuLonghui/hw-issue-31

Fix callbacks in loops