Fixed a variable not being passed on to the function.