Fixed issues with function passing variable.