fix because pass-by-reference doesn't work with call_user_func