Fix PR14180 and 14181 (patch from branch)