How to refer to correct 'this' in nested callback