Multiple commits

This request should make captive portal initialization and finalization more resilient.


Pull request with features/bugfixes being tested on testbed infrastructure.