Issue 1788, 1796, 1803

Screwed up my branch (yes I'm a git noob!), so this is combined with the last pull request.