Several fixes.

https://issues.infn.it/jira/browse/VOMS-448
https://issues.infn.it/jira/browse/VOMS-444
https://issues.infn.it/jira/browse/VOMS-459
https://issues.infn.it/jira/browse/VOMS-322
https://issues.infn.it/jira/browse/VOMS-135
Some polishing.