fixed anonymous function issue