Revert "Merge pull request #9280 from pivanov/bug-845097"

This reverts commit 0511b82061624144007eb6f16454cd7cf81b8d3f, reversing
changes made to 40d6e1385b8abc1e80a6d5723c7be0132da16c0f.
Revert "Merge pull request #8963 from pivanov/bug-845097"

This reverts commit 010a8a6124e66249aa5ac1932d01f8b384bec44a, reversing
changes made to dbc79d071a356d2c770e7a20455f730ca4668dd0.