fixed segfault due to mismatched parameters in inner loop