Second pass at #540
Merge pull request #1158 from kuyan/master

Second pass at #540