Manually merging in db412dfd91beabc2c7a27d79d8255fce6a6703b2 from master, to get the bug fix I needed