Some fixes on security mechanism.