manually patch missing part of PR#2756