Applied @renanmartins patch for issue #85