Merge notification code changes from upstream