Fixed some of the issues raised in https://github.com/gem/oq-engine/pull/1545