Applied a better fix than dad804592d51caf3a67f12ace58410dc0cccebf3 for #220