Fixes #3869 using callbacks.js coding suggestion from @peller