Ap en

Encrypted AP mode was not working because of two bugs.