second try at #567
Merge pull request #580 from nelenkov/dev

second try at #567