check loop condition before render
Merge pull request #69 from CartoDB/68-fix_extra_frame

check loop condition before render