Fix compiler error about callback lifetime

Closes #118
Merge pull request #119 from bjz/lifetime-error

Fix compiler error about callback lifetime