This patch causes a regression, so reverting it while I investigate the issue. This reverts commit e6eb84a1.