Backport 766 to stable45 fixes 1245