Added some lines from a previous patch to facilitate a rebase.