Fix previous commit

isFirstOutputOrInputOutput was declared within the loop, needed to be moved out.