Wrap callback in function to keep reference to this