Fix compiler error about callback lifetime

Closes #118