Fixes #729.
rebased onto 8a2eb1285c0634c20c498be25446a9584210064b
Thank you!
Pull-Request has been merged by pbokoc
Fixes #729.