Fix for #933 issue

This PR fixes #933, and some minor glitches detailed in the commit messages.
Maybe. As this is not my code, I did not deleted it.