Fix global function call
Remove unused variable