wrap callback funstions with arguments in anonymous functions