backport #543 for 2.3.5 as well