Correctly capture function arguments.