Fix for issue #765

This hopefully fixes #765