add context to callback function of the traverse function