Reimplement fix for #233 on the develop branch.
Merge pull request #234 from tnarik/develop

Reimplement fix for #233 on the develop branch.