fixed the visibility of a function called from within a closure