Fix for LHCBPS-1778 Cherry-picked from 2018-patches, see merge request !1227 (merged)
2018-patches
@malexand FYI