Fix for bug # 1098154

See https://bugs.launchpad.net/openquake/+bug/1098154 for a full description of the bug and steps to reproduce.