undo c27f42d Fixes #3511 and #3606