Fixed so ECP now works both on SP, IdP and Client side. Minor tweaks left.