Created by: cvrebert
Fixes part of #11019 (closed). /to @mdo for review. Would like to get this into v3.0.1.