fixes #259
Merged back from master