More fixes towards #912.
Merge pull request #928 from Bo98/issue-912-fixes

More fixes towards #912 (my proposed alternative to PR #917)