Fix https://bugs.launchpad.net/oq-engine/+bug/1226102

See the bug for an explanation