Fix bad refactor in a previous commit
boundary was reassigned in loop when is was intended to use function input one