Fixes for CKAN support

Minor fixes to improve the CKAN export feature. The current branch works very well with demo.ckan.org while datahub.io has problems. I've contacted CKAN people to know what could be the problem.