fix use of local not in a function