Backport of pr #495 to 0.9.x branch

Fixes issue #220
Merge pull request #1 from deniszh/0.9.x_HWA_fix

Backport of pr #495 to 0.9.x branch