cherry-picked commit, resolved conflict with recent promise api callback replacements