Fixes #685

This should fix issue #685. I signed the CLA as "Jacopo Notarstefano" using GitHub username "jacquerie".