bug fixing for non anonymous function