The failing assertion has been fixed and the problematic test case has been added. This reverts the revert commit fc44617f.