Important fixes pre-2.0 copied from the better-risk branch

1) fix when reading the ruptures from the db in the event based hazard calculator;
2) reflected the API changes in risklib/commonlib
3) fixed a bug with nonparametric ruptures not being saved in the db
4) added more debugging info in the QA tests for risk

Notice: the companion PRs gem/oq-commonlib#43 and gem/oq-risklib#77 are needed.