fix #238 - only check loopsin last element
Merge pull request #255 from Nami-Doc/issue238

fix #238 - only check loop last element