Bug fixes to db code
Merge branch 'master' of github.com:bbarrefors/cmsdata