Changes from the base simplesamlphp library (which didn't work)