re-apply patch from Nagano