Fixes excessive recursion in promise callback