Fixing up a few things which got lost in the attempts to fix
conflicts when merging the sharing branch into master.