Backport #978 to 0.9.x
Merge pull request #979 from deniszh/0.9.x_bp978

Backport #978 to 0.9.x