Fix reference to 'this' in callback which could be out of scope.