applied patch from ruby source