fixed infinite loop bug in popcornlib