Fix a number of problems with the delegation servlet.