Sideport upstream master fixes

This ports https://github.com/ckan/ckan/pull/1605 to our extension.
Merging upstream
Merge pull request #1 from nhsengland/IIT-111

Sideport upstream master fixes. IT WORKS!