Fixes for:
https://issues.infn.it/jira/browse/VOMS-266
https://issues.infn.it/jira/browse/VOMS-260